package com.brtbeacon.demo.lot;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;

import androidx.appcompat.app.AppCompatActivity;

import com.brtbeacon.demo.lot.entity.ParkingParams;

public class IndexActivity extends AppCompatActivity implements View.OnClickListener {

    private CheckBox cboxModeCar;
    private CheckBox cboxSimLocation;
    private CheckBox cboxShowActualLocation;
    private CheckBox cboxShowLocationBeacons;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.bb_activity_index);
        findViewById(R.id.btn_demo1).setOnClickListener(this);
        findViewById(R.id.btn_tts).setOnClickListener(this);

        cboxModeCar = findViewById(R.id.cbox_mode_car);
        cboxSimLocation = findViewById(R.id.cbox_sim_location);
        cboxShowActualLocation = findViewById(R.id.cbox_show_actual_location);
        cboxShowLocationBeacons = findViewById(R.id.cbox_show_location_beacons);
    }

    @Override
    public void onClick(View v) {

        Intent intent = null;

        switch (v.getId()) {
            case R.id.btn_demo1: {
                intent = new Intent(this, LotMapActivity.class);
                intent.setExtrasClassLoader(ParkingParams.class.getClassLoader());
                ParkingParams parkingParams = new ParkingParams();
                //  建筑ID
                parkingParams.setBuildingId("07550060");
                //  建筑对应的APPKEY
                parkingParams.setAppkey("4a7c52c8176f460db69130b0b6026136");
                //  导航模式 车行1 人行0
                parkingParams.setNavMode(cboxModeCar.isChecked()?1:0);
                //  模拟定位（可以点击模拟所在位置）
                parkingParams.setCustomLocation(cboxSimLocation.isChecked());
                //  停车位名称，当室内定位成功后，会自动进入导航状态。
                //parkingParams.setTargetPoiName("B4060");
                parkingParams.setShowActualLocation(cboxShowActualLocation.isChecked());

                parkingParams.setShowLocationBeacons(cboxShowLocationBeacons.isChecked());

                parkingParams.setZoomLevelDefault(19.0f);
                parkingParams.setZoomLevelNavigation(20.0f);

                intent.putExtra(LotMapActivity.ARG_PARKING_PARAMS, parkingParams);
                break;
            }

            case R.id.btn_tts: {
                //  测试语音播放。
                intent = new Intent(this, SpeechEngineActivity.class);
                break;
            }
        }

        if (intent != null) {
            startActivity(intent);
        }
    }






}
